*HTML Line Break*



In HTML, the <br> tag is used to insert a line break within text. Unlike the <p> (paragraph) tag, which creates separate blocks of text, the <br> tag forces text to move to the next line while remaining within the same element.



Basic Example


Explanation

  • <br> Creates a line break.
  • The text after <br> appears on the next line.

  • When to Use <br>

    The <br> tag is useful in the following cases:
  • Breaking text within a single paragraph.
  • Formatting addresses or poetry.
  • Displaying line breaks inside an inline element.

  • Example: Formatting an Address



    Using <br> in Forms

    Line breaks are useful inside forms to separate labels and input fields:




    Best Practices

  • Use <br> only when necessary. Prefer <p> for structuring text.
  • Avoid excessive <br> usage, as it can make HTML code cluttered.
  • For spacing, consider using CSS margin or padding instead of multiple <br> tags.